//
//  GameModel.h
//  NinjaTurtle
//
//  Created by Nguyen Tri Chung on 1/8/15.
//
//

#ifndef __NinjaTurtle__GameModel__
#define __NinjaTurtle__GameModel__

#include <stdio.h>
#include "cocos2d.h"
#include "../mvc/include/mvc.h"
#include "Level.h"
#include "SavedData.h"
#include "audio/include/SimpleAudioEngine.h"

USING_NS_CC;
using namespace CocosDenshion;

class Level;
class GameModel : public Model {
    CC_SYNTHESIZE_READONLY(int, gameState, GameState);
    CC_SYNTHESIZE(int, level, Level);
    CC_SYNTHESIZE(int, numberDead, NumberDead);
    CC_SYNTHESIZE_READONLY(Level*, currentLevel, CurrentLevel);
    CC_SYNTHESIZE_READONLY(SavedData*, savedData, SavedData);
protected:
    float currentDelayToNextMap;
    float currentDelayToTransit;
public:
    GameModel();
    virtual ~GameModel();
    static GameModel* getInstance();
    void loadData();
    void play(int level);
    void next();
    bool isLastMap();
    void quit();
    void pause();
    void resume();
    void replay();
    void transit(float time);
    void update(float dt);
    void save();
    void updateLevel();
};

#endif /* defined(__NinjaTurtle__GameModel__) */
